import request from '@/utils/request'
import httpRequest from '@/utils/httpRequest'

export function saveTestcase(data) {
  return request({
    url: '/testcase/save',
    method: 'post',
    data
  })
}

export function deleteTestcase(data) {
  return request({
    url: '/testcase/deleteFile/'+data,
    method: 'get'
  })
}

export function getTestcase(data) {
  return request({
    url: '/testcase/get'+'/'+data,
    method: 'get',
  })
}

export function updateTestcase(data) {
  return request({
    url: '/testcase/saveDesc',
    method: 'post',
    data
  })
}

export function addTestcase2Testplain(param,fileId,data){
  return request({
    url:'/testplaincase/addtestcase'+'/'+param+'/'+fileId,
    method:'post',
    data
  })
}

export function getTestcasePlain(param){
  return request(
    {
      url:'/testplaincase/gettestcaseplain'+'/'+param,
      method:'get'
    }
  )
}

export function exportTestcase(data,fileName){
  return httpRequest.defaultDownloadPost(
    '/testplaincase/gettestcaseplain/exporttestcaseexcel',
    "post",
    data,
    fileName
  )
}


export function exportXmindFile(data,fileName){
  return httpRequest.defaultDownloadPost(
    '/testcase/download/'+data,
    "get",
    null,
    fileName
  )
}

export function translateXmind2Test(data){
  return request({
    url:'/testcase/translateXmind2Test/'+data,
    method:'get'
  })
}

